-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flepimop patch
Abilities And Documentation
#423
Conversation
Added a unit test to demonstrate the issue described in #375 (comment) with respect to the `seir::parameters` section. Appears to be related to if the parameters are a list or a dict.
ef09f6e
to
b21cfcc
Compare
Commit b21cfcc demonstrates the |
... I hate Okay, the short circuit solution here is to hard error rather than warn on top level key collisions. I'm fine with that for now - thoughts? |
Corrected an issue where `parse_config_files` would try to merge top-level keys which comes from `confuse`. Work around is to manually build a dictionary and then convert that to a `Configuration` object.
For configuration of the outputted yaml.
@pearsonca 02678a3 restores the documented behavior. @saraloo fe1dc2b adds an |
d397eb1
to
ba22f0b
Compare
quick note: i thought we had settings such that |
e6ced61
to
b34792d
Compare
Added an internal utility to custom format the yaml representation of a `confuse.Configuration` object. Creates a custom `yaml.Dumper` class that contains all of the custom representation changes as to not modify the `yaml` pkg defaults.
def patch(ctx: click.Context = mock_context, **kwargs) -> None: | ||
"""Merge configuration files | ||
|
||
This command will merge multiple config files together by overriding the top level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should frame the example in the way we actually expect people to use the tool: flepimop patch config1.yml config2.yml > confignew.yml
. Showing the output still useful so maybe do the piping, followed by a cat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point, I've amended the last commit to reflect this.
Changed the help page to use existing files in the `examples/tutorials` directory rather than construction test configs on the fly per a suggestion by @pearsonca.
8de5973
to
0fe483e
Compare
This PR:
|
``` | ||
|
||
You may provide an arbitrary number of separate configuration files to combine to create a complete configuration. | ||
|
||
## Caveats | ||
|
||
At this time, only `simulate` supports multiple configuration files. Also, the patching operation is fairly crude: configuration options override previous ones completely, though with a warning. The files provided from left to right are from lowest priority (i.e. for the first file, only options specified in no other files are used) to highest priority (i.e. for the last file, its options override any other specification). | ||
At this time, only `simulate` supports multiple configuration files. Also, the patching operation is fairly crude: if multiple configuration files specify the same option, this will yield an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propose just a clarifying statement to make things a bit more explicit.
At this time, only
simulate
directly supports multiple configuration files, and our current patching capabilities only allow for the addition of new sections as given in our tutorials. This is helpful for building models piece-by-piece from a simple compartmental forward simulation, to including outcome probabilities, and finally, adding modifier sections. If multiple configuration files specify the same higher level configuration chunks (e.g.,seir
,outcomes
), this will yield an error.
@@ -32,46 +32,17 @@ you'll get a basic foward simulation of this example model. However, you might a | |||
flepimop simulate config_sample_2pop.yml config_sample_2pop_outcomes_part.yml | |||
``` | |||
|
|||
if want to see what the combined configuration is, you can use the `patch` command: | |||
if want to create a combined configuration (e.g. to check what the combined configuration is), you can use the `patch` command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should suggest this as a way to start - should look at the config before you run it. Maybe for later, should include that simulate should print out the patched config regardless - so it can be tracked what exactly was run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps change this wording to:
While
simulate
can run your patched configuration, we also suggest you check your configuration file using thepatch
command:
Stronger and clearer wording suggested by @saraloo.
Describe your changes.
This pull request is in response to #375 (comment).
Does this pull request make any user interface changes? If so please describe.
The user interface changes are...
Those are reflected in updates to the documentation in ...
Tag relevant team members.
@saraloo @pearsonca